﻿import com.dmotiko.mirador.*
import com.dmotiko.general.*
import mx.utils.Delegate;

class MiradorHomeMirador
extends MiradorSiteSection {
	private var mcButtonBar:MiradorMainBtnBar;
	
	function MiradorHomeMirador() {
		super( MiradorSite.getApp() );
		sName = MiradorSite.HOME;
		MiradorSite.getApp().addEventListener( MiradorSite.CONTEXT_CHANGED, Delegate.create( this, sectionChanged));
		sectionChanged();
	}
	
	private function sectionChanged(evnt) {
		if( MiradorSite.getApp().getSection() == MiradorSite.HOME && MiradorSite.getApp().getContext() == MiradorSite.MIRADOR) {
			showSection();
		} else {
			hideSection();
		}
	}
	
	public function showSection() {
		if (bShowed) return;
		bShowed = true;
		this.gotoAndStop(2);
		showEnd();
	}
	
	public function hideSection() {
		//trace("MiradorHomeMirador hideSection");
		if (!bShowed) return;
		bShowed = false;
		this.gotoAndStop(1);
		hideEnd();
	}
		
}